package cn.com.fattiger.framework;

import static java.lang.System.out;
import cn.com.fattiger.framework.model.UserInfo;

public class ThreadTowStart {
	public static int a = 1;
	public static int hash = 0;
	public static void main(String[] args) {
		Thread t1 = new Thread(new Runnable() {
			@Override
			public void run() {
				a++;
			}
		});
		t1.start();
		out.print(t1.getState().ordinal());

		UserInfo a = new UserInfo();
		Thread t3 = new Thread(a,"T3");
		UserInfo b = new UserInfo(t3);
		Thread t2 = new Thread(b,"T2");
		t2.start();
		t3.start();
		Thread t4 = new Thread(a,"T4");
		t4.start();
		System.out.println(a.getId());
		String AA = "abcdef";
		out.println(hashDemo(AA.toCharArray()));
		String BB = "fedcba";
		out.println(hashDemo(BB.toCharArray()));
	}
	
	public static int hashDemo(char[] value){
		int h = hash;
        if (h == 0 && value.length > 0) {
            char val[] = value;

            for (int i = 0; i < value.length; i++) {
                h = 31 * h + val[i];
            }
            hash = h;
        }
        return h;
	}
}
